﻿//namespace WXWorkSvc.Common.TagHelpers;

///// <summary>
///// <div class="weui-panel">
/////        <div class="weui-panel__bd weui-cells" style="margin:0">
/////            <a-weui-media asp-para='new LinkPara("","./Edit")' asp-title="新增" asp-info-1="新增一个房型" />
/////            @foreach(var item in Model.Items)
/////            {}
/////        </div>
/////    </div>
/////</div>
///// </summary>

//[HtmlTargetElement("a-weui-media", TagStructure = TagStructure.NormalOrSelfClosing)]
//public class WeuiMediaAnchorTagHelper : TagHelper
//{
//    private readonly IHtmlGenerator _HtmlGenerator;
//    [HtmlAttributeName("asp-title")]
//    public string Title { get; set; } = default!;
//    [HtmlAttributeName("asp-extra")]
//    public string? Extra { get; set; }
//    [HtmlAttributeName(DictionaryAttributePrefix = "asp-info-")]
//    public IDictionary<string, string> Infos { get; set; } = new Dictionary<string, string>();
//    [HtmlAttributeName("asp-para")]
//    public LinkPara LinkPara { get; set; } = default!;
//    [HtmlAttributeNotBound]
//    [ViewContext]
//    public ViewContext ViewContext { get; set; } = default!;
//    public WeuiMediaAnchorTagHelper(IHtmlGenerator generator)// : base(generator)
//    {
//        _HtmlGenerator = generator;
//    }
//    public override void Process(TagHelperContext context, TagHelperOutput output)
//    {
//        var tagBuilder = _HtmlGenerator.GeneratePageLink(ViewContext, LinkPara.LinkText, LinkPara.PageName, LinkPara.PageHandler, null, null, null, LinkPara.RouteValues, LinkPara.HtmlAttributes);
//        tagBuilder.MergeAttribute("class", "weui-cell weui-cell_access");


//        output.TagName = "a";
//        output.TagMode = TagMode.StartTagAndEndTag;
//        output.MergeAttributes(tagBuilder);//.Attributes.AddClass("weui-cell weui-cell_access");

//        var sbLi = new StringBuilder();
//        foreach (var item in Infos.Values)
//        {
//            sbLi.AppendLine($"""
//                <li class="weui-media-box__info__meta">{item}</li>
//                """);
//        }
//        if (!string.IsNullOrEmpty(Extra))
//            sbLi.Append($"""
//                <li class="weui-media-box__info__meta weui-media-box__info__meta_extra">{Extra}</li>
//                """); 


//        output.Content.SetHtmlContent($""""
//                                        <div class="weui-cell__bd">
//                                            <div class="weui-media-box weui-media-box_text" style="padding:0">
//                                                <h4 class="weui-media-box__title">{Title}</h4>
//                                                <ul style="margin-top:5px" class="weui-media-box__info">
//                                                    {sbLi}
//                                                </ul>
//                                            </div>
//                                        </div>
//                                        <div class="weui-cell__ft">
//                                        </div>
//                                        """");

//    }
//}
